package controller;

import java.io.IOException;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import dao.XxDao;

/**
 * Servlet implementation class DeleteUserServlet
 */
@WebServlet("/XxFdyDeleteServlet")
public class XxFdyDeleteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		String id = request.getParameter("id");
        XxDao dao = new XxDao();
		boolean success = dao.deleteFdyXx(id);
		 if (success) {
			 response.sendRedirect("View_xx/XxFdy.jsp"); // 删除成功后跳转到用户列表页面
	        } else {
	            response.getWriter().write("删除失败");
	        }
	}

}